<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Store extends Model
{
    //
    protected $table = 'stores';

    /**
     * 更新
     * @param array $data
     * @return bool|void
     */
    public function saveOne(array $data){
        $this->uid = $data['uid'];
        $this->linkname = $data['linkname'];
        $this->cate_ids = $data['cate_ids'];
        $this->phone = $data['phone'];
        $this->start_time = $data['start_time'];
        $this->end_time = $data['end_time'];
        $this->address = $data['address'];
        $this->address_detail = $data['address_detail'];
        $this->lat = $data['lat'];
        $this->lnt = $data['lnt'];
        $this->imgurl = $data['imgurl'];
        $this->title = $data['title'];
        $this->status = $data['status'];
        $this->save();
        return $this->id;
    }

    public function user(){
        return $this->hasOne('App\User', 'id', 'uid');
    }
}
